{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=325
  Verdict: Accepted
}
uses SysUtils, Math;
 
type
	point=record
		x,y:longint;
		s:int64;
	end;
 
var
	i,n:longint;
	a:array[0..110] of point;
 
procedure sort(l,r:longint);
var 
	i,j,x:longint;
	y:point;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2].s;
repeat
	while a[i].s<x do inc(i);
  while a[j].s>x do dec(j);
  if i<=j then begin
    y:=a[i];
    a[i]:=a[j];
    a[j]:=y;
    inc(i);
    dec(j);
  end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
for i:=1 to n do begin
	read(a[i].x,a[i].y);
	a[i].s:=a[i].x*a[i].x+a[i].y*a[i].y;
end;
sort(1,n);
for i:=1 to n do
	writeln(a[i].x,' ',a[i].y);
end.